﻿using MediatR;
using RBAC.LuFang.API.Application.Command.RoleCommand;
using RBAC.LuFang.Domain.DTO;
using RBAC.LuFang.Domin.Services;

namespace RBAC.LuFang.API.Application.CommandHandlers.RoleHandler
{
    //显示某角色的员工
    public class RoleEmployeeCommandHandler:IRequestHandler<RoleEmployeeCommand, List<GetRoleNameDTO>>
    {
        private readonly IRoleService _roleService;

        public RoleEmployeeCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<List<GetRoleNameDTO>> Handle(RoleEmployeeCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.GetRoleName(request.roleId);
        }
    }
}
